package com.hrms.hrms_employee.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hrms.hrms_employee.dao.StaffPositionDao;
import com.hrms.hrms_employee.entity.StaffPosition;
import com.hrms.hrms_employee.service.StaffPositionService;
import com.hrms.hrms_employee.vo.staffPostionDetailVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 员工职位表(StaffPosition)表服务实现类
 *
 * @author makejava
 * @since 2025-01-17 16:55:59
 */
@Service("staffPositionService")
public class StaffPositionServiceImpl extends ServiceImpl<StaffPositionDao, StaffPosition> implements StaffPositionService {

    @Autowired
    private StaffPositionDao staffPositionDao;

    /**
     * 查询员工详细信息，个人基本信息、部门岗位信息、合同信息（实习、是否转正、是否晋升）
     *
     * @param id
     * @return
     */
    @Override
    public staffPostionDetailVO pageInfo(Long id) {
        staffPostionDetailVO postionDetailPage = this.staffPositionDao.pageInfo(id);
        return postionDetailPage;
    }

    /**
     * 根据department_id查询所有所属员工
     *
     * @param stationId
     * @return
     */
    @Override
    public List<StaffPosition> selectDepartmentStaffs(Long stationId) {
        List<StaffPosition> list = this.list(new QueryWrapper<StaffPosition>().eq("station_id", stationId).eq("is_deleted", 0));
        return list;
    }

    /**
     * 获取员工信息
     * @param id
     * @return
     */
    @Override
    public StaffPosition position(Long id) {
        return this.staffPositionDao.position(id);
    }
}

